<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const obj = { a: 1, b: 2 };

      const proxy = new Proxy(obj, {
        set(target, propertyKey, value, recevier) {
          // target[propertyKey] = value;
          Reflect.set(target, propertyKey, value, recevier);
        },
        get(target, propertyKey) {
          if (Reflect.has(target, propertyKey)) {
            return Reflect.get(target, propertyKey);
          } else {
            return undefined;
          }
        },
        has(target, propertyKey) {
          return false;
        },
      });

      console.log(proxy);
      proxy.a = 10;
      console.log(proxy.a);
      console.log("a" in proxy);
    </script>
  </body>
</html>
